﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace AliyunMobileTestTechnology.ViewModel.Converters
{
    /// <summary>
    /// 当需要将一个bool属性绑定到多个UI元素，
    /// 而这些UI元素对初始状态的true和false要求不一致时
    /// 可以使用这个转换器
    /// </summary>
    [ValueConversion(typeof(bool), typeof(bool))]
    public class NegateBoolConverter:IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return !((bool)value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return !((bool)value);
        }
    }
}
